<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button type="button" onclick="console.log(1);">点击</button>
<button type="button" onclick="addRow()">添加</button>
<table></table>
<script>
    let btn = document.querySelector("button");
    let si = setInterval(function () {
        btn.click();//触发点击事件
    }, 1000);
    clearInterval(si);

    let table = document.querySelector("table");
    let thead = table.createTHead();
    let tr = thead.insertRow(0);
    let td = tr.insertCell(0);
    td.innerText = "序号";
    let tbody = table.createTBody();

    function addRow() {
        let tr = tbody.insertRow(tbody.rows.length);
        let arr = [tbody.rows.length, "<button type='button'>点击</button>", "<input type='checkbox'>"];
        // let td = tr.insertCell(0);
        // td.innerHTML = arr[0];
        // td = tr.insertCell(1.txt);
        // td.innerHTML = arr[1.txt];
        // td = tr.insertCell(2);
        // td.innerHTML = arr[2];
        arr.forEach(function (value, index) {
            let td = tr.insertCell(index);
            td.innerHTML = value;
        });
    }
</script>
</body>
</html>